using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// 带按钮功能的皮肤部位映射
/// </summary>
public class SkinInfo : MonoBehaviour
{
    [SerializeField, Header("皮肤套装")]
    public ESkin ESkin;
    [SerializeField, Header("插槽")]
    public ESlot Slot;

    public SetSkin SkinTarget;

    #region 属性字段
    // TODO 套装属性,进行哪些更改
    #endregion
    public SkinInfo(ESkin eSkin, ESlot slot)
    {
        ESkin = eSkin;
        Slot = slot;
    }

    public Button SkinButton;

    /// <summary>
    /// 更新装备数据
    /// </summary>
    private void InvokeDataRefresh()
    {
    }

    public void Awake()
    {
        SkinTarget = GameObject.Find("LeadSpineAnim").GetComponent<SetSkin>();
        SkinButton = GetComponent<Button>();

        SkinButton.onClick.AddListener(() =>
        {
            var clickSuccessed = SkinTarget.ReceiveClick(SkinButton, ESkin, Slot);
            if (clickSuccessed)    //回调函数处理，进行属性数据更新
            {
                InvokeDataRefresh();
            }
        });
    }
}